<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('来源基本表列表')"/>
</head>
<body class="gray-bg">
<div class="container-div">
    <div class="row">
        <div class="col-sm-12 search-collapse">
            <form id="formId">
                <div class="select-list">
                    <ul>
                        <li>
                            <label>渠道编号：</label>
                            <input type="text" name="channelCode"/>
                        </li>

                        <li>
                            <label>渠道名称：</label>
                            <input type="text" name="channelName"/>
                        </li>
<!--                        <li>-->
<!--                            <label>描述信息：</label>-->
<!--                            <input type="text" name="descInfo"/>-->
<!--                        </li>-->
<!--                        <li>-->
<!--                            <label>基本金额：</label>-->
<!--                            <input type="text" name="baseAmount"/>-->
<!--                        </li>-->
                        <!--    <li>
                                <label>appKey：</label>
                                <input type="text" name="appKey"/>
                            </li>
                            <li>
                                <label>appSecret：</label>
                                <input type="text" name="appSecret"/>
                            </li>-->
                        <li>
                            <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i
                                    class="fa fa-search"></i>&nbsp;搜索</a>
                            <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i
                                    class="fa fa-refresh"></i>&nbsp;重置</a>
                        </li>
                    </ul>
                </div>
            </form>
        </div>

        <div class="btn-group-sm" id="toolbar" role="group">
            <a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="source:baseinfo:add">
                <i class="fa fa-plus"></i> 添加
            </a>
<!--            <a class="btn btn-primary single disabled" onclick="$.operate.edit()"-->
<!--               shiro:hasPermission="source:baseinfo:edit">-->
<!--                <i class="fa fa-edit"></i> 修改-->
<!--            </a>-->
            <!-- <a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()" shiro:hasPermission="source:baseinfo:remove">
                 <i class="fa fa-remove"></i> 删除
             </a>-->
            <!--  <a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="source:baseinfo:export">
                  <i class="fa fa-download"></i> 导出
              </a>-->
        </div>
        <div class="col-sm-12 select-table table-striped">
            <table id="bootstrap-table"></table>
        </div>
    </div>
</div>
<th:block th:include="include :: footer"/>
<script th:inline="javascript">
    var editFlag = [[${@permission.hasPermi('source:baseinfo:edit')}]];
    var removeFlag = [[${@permission.hasPermi('source:baseinfo:remove')}]];
    var prefix = ctx + "source/baseinfo";

    $(function () {
        var options = {
            url: prefix + "/list",
            createUrl: prefix + "/add",
            updateUrl: prefix + "/edit/{id}",
            removeUrl: prefix + "/remove",
            exportUrl: prefix + "/export",
            modalName: "来源基本表",
            columns: [
            //     {
            //     checkbox: true
            // },
                {
                    field: 'id',
                    title: 'ID'
                },
                {
                    field: 'channelCode',
                    title: '渠道编号'
                },
                {
                    field: 'channelName',
                    title: '渠道名称'
                },
                {
                    field: 'descInfo',
                    title: '描述信息'
                },
                // {
                //     field: 'baseAmount',
                //     title: '基本金额'
                // },
                {
                    field: 'flowTypeStr',
                    title: '流程类型'
                },
                {
                    field: 'settleFlagStr',
                    title: '结算类型'
                },
                // {
                //     field: 'encryptType',
                //     title: '加密类型'
                // },
                {
                    field: 'statusStr',
                    title: '状态'
                },
                {
                    field: 'pushFlagStr',
                    title: '推送标志'
                },
                {
                    field: 'extData',
                    title: '扩展数据'
                },
                {
                    field: '',
                    title: '任务',
                    formatter: function (value, row, index) {
                        return '<a class="btn btn-info btn-xs " href="javascript:void(0)" onclick="itemInfoList(\'' + row.id + '\', \'' + row.channelName + '\')">任务</a>';
                    }
                },
                {
                    field: '',
                    title: '密钥信息',
                    formatter: function (value, row, index) {
                        return '<span style="color: darkgreen; border-bottom: 1px solid" onclick="showAccount( \'' + row.channelName + '\',\'' + row.channelCode + '\',\'' + row.appKey + '\' ,\'' + row.appSecret + '\' )">展示</span>'
                    }
                },
                /* {
                     field: 'appSecret',
                     title: 'appSecret'
                 },*/
                /*  {
                      field: 'pubKey',
                      title: 'pubKey'
                  },
                  {
                      field: 'priKey',
                      title: 'priKey'
                  },*/
                {
                    title: '操作',
                    align: 'center',
                    formatter: function (value, row, index) {
                        var actions = [];
                        actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.id + '\')"><i class="fa fa-edit"></i>编辑</a> ');
                        // actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.id + '\')"><i class="fa fa-remove"></i>删除</a>');

                        return actions.join('');
                    }
                }]
        };
        $.table.init(options);
    });
/*
 * 展示
 */
    function showAccount(channelName,channelCode, appKey,appSecret) {
        var content =
        '渠道名称：'+ channelName +
        '<br>appCode：'+ channelCode +
        /*'<br>appKey：'+ appKey +*/
        '<br>appSecret：' + appSecret +
        '<br>请求地址：http://api.renxinhua.cn'
        $.modal.alert(content, modal_status.MESSAGE, '密钥信息');
    }

    /*
     * 任务
     */
    function itemInfoList(Id, channelName) {
        var url = ctx + 'source/taskinfo/'+Id;
        $.modal.openTab(channelName + '-任务列表', url);
    }

</script>
</body>
</html>